package com.ruoyi.web.controller.wx_warehouseman;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.vqms.domain.VQMSFactory;
import com.ruoyi.vqms.service.IVQMSFactoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/wx/warehouseman/factory")
public class warehouseFactoryController {

    @Autowired
    private IVQMSFactoryService factoryService;

    /**
     * 查询工厂名称(不分页)
     */
    @GetMapping("/getName/{id}")
    public AjaxResult getName(@PathVariable Long id){
        return AjaxResult.success(factoryService.getById(id));
    }

    /**
     * 查询工厂列表(不分页)
     */
    @RequestMapping("/getList")
    public AjaxResult getList(VQMSFactory vqmsFactory){
        List<VQMSFactory> list=factoryService.selectList(vqmsFactory);
        List<VQMSFactory> filteredList = list.stream()
                .filter(factory ->
                        !"广西玉驰仓储管理有限公司".equals(factory.getName()) && !"广西玉柴机器股份有限公司".equals(factory.getName())
                )
                .collect(Collectors.toList());
        return AjaxResult.success(filteredList);
    }
}
